package com.bytedance.improvingroad.activity

import android.util.Log
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.bytedance.improvingroad.R
import com.bytedance.improvingroad.adapter.RVActivityListAdapter
import com.bytedance.improvingroad.model.Family
import com.bytedance.improvingroad.widget.RVTestDecoration

/**
 * Created by chenxiong
 * date 11/9/21
 */
class RvActivity: BaseActivity() {
    private lateinit var mRecycler: RecyclerView
    override fun init() {
        mRecycler = findViewById(R.id.rv_list)
        val list = mutableListOf<Family>()
        for (i in 0..5) {
            for (j in 0..6) {
                if(i%2 == 0) {
                    list.add(Family("小王", j))
                } else {
                    list.add(Family("小张", j))
                }
            }
        }
        Log.e("cx","list大小:${list.size}")
        mRecycler.adapter = RVActivityListAdapter(list)
        mRecycler.layoutManager = LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false)
        mRecycler.addItemDecoration(RVTestDecoration())
    }

    override fun getLayoutId() = R.layout.activity_rv
}